/**
 * Copyright 2009-2011 the original author or authors.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.myjung.model;

import java.util.ArrayList;
import java.util.List;

import net.myjung.model.annotation.MdlAttribute;
import net.myjung.model.annotation.MdlElement;

/**
 * @author Steve M. Jung
 */
@SuppressWarnings("serial")
public class Mail extends BaseObject {
	private MailAddress from;
	@MdlElement(singular = "to")
	private List<MailAddress> tos;
	@MdlElement(singular = "cc")
	private List<MailAddress> ccs;
	@MdlAttribute
	private String subject;
	private MailContent content;
	@MdlElement(singular = "attachment")
	private List<MailAttachment> attachments;
	public MailAddress getFrom() {
		return from;
	}
	public void setFrom(MailAddress from) {
		this.from = from;
	}
	public List<MailAddress> getTos() {
		return tos;
	}
	public void setTos(List<MailAddress> tos) {
		this.tos = tos;
	}
	public void setTo(MailAddress to) {
		this.tos = null;
		if (to == null)
			return;
		this.tos = new ArrayList<MailAddress>();
		this.tos.add(to);
	}
	public List<MailAddress> getCcs() {
		return ccs;
	}
	public void setCc(MailAddress cc) {
		ccs = null;
		if (cc == null)
			return;
		ccs = new ArrayList<MailAddress>();
		ccs.add(cc);
	}
	public void setCcs(List<MailAddress> ccs) {
		this.ccs = ccs;
	}
	public String getSubject() {
		return subject;
	}
	public void setSubject(String subject) {
		this.subject = subject;
	}
	public MailContent getContent() {
		return content;
	}
	public void setContent(MailContent content) {
		this.content = content;
	}
	public List<MailAttachment> getAttachments() {
		return attachments;
	}
	public void setAttachments(List<MailAttachment> attachments) {
		this.attachments = attachments;
	}
}
